Conversation
|
Hi! Thank you for your submit. So to understand it correctly, you're saying that you have to call select between the accept and the recv? |
|
Hi, yes, that's what I observed, select between accept and recv fixed it. If the socket was intended to be blocking, it wasn't in my case, as far as I could tell. |
|
Then again, MicroProfileSetNonBlocking(S.ListenerSocket, 1); is being called, so maybe it's supposed to be non-blocking after all? |
|
I think this is where it is platform dependent. I'm pretty sure I remember window always creates sockets in Blocking mode. |
|
This is my understanding as well:
The ListenerSocket is created as non-blocking here: Then
|
|
Hi. Can you try this code, and see if this fixes your issue? The intent of the code here is that the socket should be blocking, but it seems like it isn't. |
|
Confirming that your fix also works. |
This fixes an issue where recv() is called on a non-blocking socket immediately after accept() before it's ready for reading, returns -1 and the connection is closed.
I found this when I was trying to profile a Windows executable running in Wine on Linux in a Docker container in Kubernetes on AWS. I tried to connect to it from a local web browser via kubectl port-forward and it kept closing the connection 100% of the times. This was the only setup I was able to reproduce it with. I believe the kubectl port-forward was the main trigger for the issue because I didn't observe it when connecting from inside the Docker container.